package com.xish.api.operating;


import com.xish.model.bean.Operating;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperatingService {

    @Autowired
    private OperatingRepository operatingRepository;

    public int calculateOperatingSortByActivityIndex(int activityIndex) {
        if (activityIndex == 1) {
            return 1;
        } else if (activityIndex == 2) {
            return 4;
        } else if (activityIndex == 4) {
            return 2;
        } else if (activityIndex == 8) {
            return 3;
        } else if (activityIndex == 11) {
            return 5;
        } else {
            return 0;
        }
    }

    public List<Operating> findByCondition(OperatingCondition condition) {
        return operatingRepository.findByCondition(condition);
    }

}
